<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('candidate')} > ${i18n.getMessage('info')}">
<a href="#" onclick="cc('register/showRegisters.sgt?candidateId=${candidate.id}');">${i18n.getMessage('register')} ${i18n.getMessage('history')}</a> |
<a href="#" onclick="cc('register/showAddRegister.sgt?candidateId=${candidate.id}');">${i18n.getMessage('register')}</a> |
<a href="#" onclick="if(confirm('${i18n.getMessage('dialog.delete')}')) { cc('englishtest/deleteCandidate.sgt?id=${candidate.id}'); }">${i18n.getMessage('delete')}</a>
</@showTitle>

<div id="error" style="display:none;"></div>

<form action="englishtest/editCandidate.sgt" validator="englishtest/validateCandidate.sgt" onsubmit="submitFormValidation(this); return false;"  onreset="$('error').hide();">
	<input type="hidden" name="id" value="${(candidate.id)!}"/>
	<input type="hidden" name="version" value="${(candidate.version)!}"/>
	
	<table id="dataTable" cellspacing="5" align="center" cellpadding="0">
		<tr>
			<td class="name"><@required/>${i18n.getMessage('student.code')}:</td>
			<td>${(candidate.candidateCode)!}</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('firstName')}:</td>
			<td><input type="text" name="firstName" value="${(candidate.firstName)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('lastName')}:</td>
			<td><input type="text" name="lastName" value="${(candidate.lastName)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('nickName')}:</td>
			<td><input type="text" name="nickName" value="${(candidate.nickName)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('gender')}:</td>
			<td>
				<input type="radio" name="gender" value="MALE" <#if 'MALE' = (candidate.gender)!>checked</#if>/> ${i18n.getMessage('gender.male')}
				<input type="radio" name="gender" value="FEMALE" <#if 'FEMALE' = (candidate.gender)!>checked</#if>/> ${i18n.getMessage('gender.female')}
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('dateOfBirth')}:</td>
			<td><input type="text" name="dateOfBirth" value="${(candidate.dateOfBirth?date)!}" class="w200" /><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].dateOfBirth, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('address')}:</td>
			<td><input type="text" name="address" value="${(candidate.address)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('email')}:</td>
			<td><input type="text" name="email" value="${(candidate.email)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('phoneNumber')}:</td>
			<td><input type="text" name="phoneNumber" value="${(candidate.phoneNumber)!}" class="w200" /></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('type')}:</td>
			<td>
				<select name="typeId" class="w200">
					<#list types as type>
						<option value="${(type.id)!}" <#if type=candidate.type>selected</#if>>${(type.name)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>Registered Date:</td>
			<td><input type="text" name="registeredDate" value="${(candidate.registeredDate?date)!}" class="w200"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].consultedDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('Consultant')}:</td>
			<td>
				<select name="consultantId" class="w200">
					<option></option>
					<optgroup label="Active">
						<#list consultants as consultant>
							<#if consultant.active>
								<option value="${(consultant.id)!}" <#if consultant == (candidate.consultant)!>selected</#if> style="<@formatOnConsultant consultant/>">${(consultant.fullName)!}</option>								
							</#if>
						</#list>
					</optgroup>
					<optgroup label="Inactive">
						<#list consultants as consultant>
							<#if !consultant.active>
								<option value="${(consultant.id)!}" <#if consultant == (candidate.consultant)!>selected</#if> style="<@formatOnConsultant consultant/>">${(consultant.fullName)!}</option>								
							</#if>
						</#list>					
					</optgroup>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
			<td><textarea name="comment" name="comment" class="w350 h075">${(candidate.comment)!}</textarea></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" value="${i18n.getMessage('edit')}"  class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>

<script>
$('error').hide();
showHideInfo = function(selector) {
	if (selector.value == "") {
		$("pop").style.display = "none"
	}
	else { $("pop").style.display = "" }
}
</script>